
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { SupplyManagementAddDriversComponent } from './components/add-drivers/add-drivers.component';
import { SupplyManagementBulkDetailComponent } from './components/bulk-detail/bulk-detail.component';
import { SupplyManagementBulkPublishComponent } from './components/bulk-publish/bulk-publish.component';
import { SupplyManagementBulkReleasePublishComponent } from './components/bulk-release-publish/bulk-release-publish.component';
import { SupplyManagementIndexComponent } from './components/index/index.component';
import { InsuranceManagesComponent } from './components/insurance-manages/insurance-manages.component';
import { SupplyManagementOnecarPublishComponent } from './components/onecar-publish/onecar-publish.component';
import { SupplyManagementReleasePublishComponent } from './components/release-publish/release-publish.component';
import { SupplyManagementVehicleDetailComponent } from './components/vehicle-detail/vehicle-detail.component';

const routes: Routes = [
  {
    path: 'index',
    component: SupplyManagementIndexComponent,
    data: { guard: { ability: ['SUPPLY-INDEX-vehicleSearch', 'SUPPLY-INDEX-bulkSearch'] } }
  },
  {
    path: 'insurance',
    component: InsuranceManagesComponent,
    data: { guard: { ability: ['SUPPLY-INDEX-vehicleSearch', 'SUPPLY-INDEX-bulkSearch'] } }
  },
  {
    path: 'index/bulk-detail/:id',
    component: SupplyManagementBulkDetailComponent,
    data: {
      guard: { ability: ['SUPPLY-BULK-DETAIL-cancelSupply', 'SUPPLY-BULK-DETAIL-updatePrice', 'SUPPLY-BULK-DETAIL-bulkAnotherOrder'] }
    }
  },
  {
    path: 'index/vehicle-detail/:id',
    component: SupplyManagementVehicleDetailComponent,
    data: {
      guard: {
        ability: [
          'SUPPLY-VEHICLE-DETAIL-cancelSupply',
          'SUPPLY-VEHICLE-DETAIL-changeSupply',
          'SUPPLY-VEHICLE-DETAIL-vehiclePlaceOrder',
          'SUPPLY-VEHICLE-DETAIL-vehicleAnew'
        ]
      }
    }
  },
  { path: 'add-drivers', component: SupplyManagementAddDriversComponent },
  {
    path: 'vehicle-amend/:id',
    component: SupplyManagementOnecarPublishComponent,
    data: {
      guard: {
        ability: ['SUPPLY-VEHICLE-AMEND-submitChange']
      }
    }
  },
  {
    path: 'vehicle-next/:id',
    component: SupplyManagementOnecarPublishComponent,
    data: {
      guard: {
        ability: [
          'SUPPLY-VEHICLE-PLACEORDER-QRCode',
          'SUPPLY-VEHICLE-PLACEORDER-vehicleDesignate',
          'SUPPLY-VEHICLE-PLACEORDER-vehicleAnotherOrder'
        ]
      }
    }
  },
  {
    path: 'vehicle-release',
    component: SupplyManagementReleasePublishComponent,
    data: {
      guard: { ability: ['SUPPLY-VEHICLE-RELEASE-bulkDesignate', 'SUPPLY-VEHICLE-RELEASE-bulkDriverOrder'] }
    }
  },
  {
    path: 'bulk-release',
    component: SupplyManagementBulkReleasePublishComponent,
    data: {
      guard: { ability: ['SUPPLY-BULK-RELEASE-consignBulkAssign', 'SUPPLY-BULK-RELEASE-consignBulk'] }
    }
  },
  {
    path: 'bulk-next/:id',
    component: SupplyManagementBulkPublishComponent,
    data: {
      guard: { ability: ['SUPPLY-BULK-PLACEORDER-vehicleAnotherOrder', 'SUPPLY-BULK-PLACEORDER-vehicleDesignate'] }
    }
  },
  { path: 'bulk-amend/:id', component: SupplyManagementBulkPublishComponent }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class SupplyManagementRoutingModule {}
